<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/mpegts.js/dist/mpegts.js"></script>
</head>

<body>
    <button id="playButton">播放直播</button>
    <video id="videoElement" style="width: 100%; height: 100%;" preload="auto" autoplay controls></video>

    <script>
        document.getElementById('playButton').addEventListener('click', function () {
            if (mpegts.getFeatureList().mseLivePlayback) {
                var videoElement = document.getElementById('videoElement');
                var player = mpegts.createPlayer({
                    type: 'flv',  // could also be mpegts, m2ts, flv
                    isLive: true,
                    url: 'http://192.168.124.144:8000/live/stream.flv',
                    hasAudio: false,
                });
                player.attachMediaElement(videoElement);
                player.load();
                player.play();
            }
        });
    </script>
</body>



</html>